<template>
  <div class="app-container">
    <el-drawer
      :title="title"
      :visible.sync="openDetail"
      size="80%"
      @close="cancel"
      :append-to-body="true"
    >
      <template v-slot:title>
        <span class="titleDiv">{{ title }}</span>
      </template>
      <div style="padding: 0 20px">
        <el-tag size="large" style="font-size: 20px">基本信息</el-tag>
        <hr />
        <el-row :gutter="20">
          <el-col :span="9">
            <div class="grid-content bg-purple">
              <span>出库单编号：</span>
              <span>{{ form.salseCode }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg-purple">
              <span>出货检验单：</span>
              <span>{{ form.oqcCode }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg-purple">
              <span>发货单据编号：</span>
              <span>{{ form.soCode }}</span>
            </div>
          </el-col>
        </el-row>

        <el-row :gutter="20">
          <el-col :span="9">
            <div class="grid-content bg-purple">
              <span>客户名称：</span>
              <span>{{ form.clientName }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg-purple">
              <span>出库日期：</span>
              <span>{{ form.salseDate }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg-purple">
              <span>单据状态:</span>
              <span>
                <dict-tag :options="dict.type.mes_order_status" :value="form.status" />
              </span>
            </div>
          </el-col>
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <div class="grid-content bg-purple">
              <span>承运商：</span>
              <span>{{ form.carrier || '--' }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg-purple">
              <span>运费：</span>
              <span>{{ form.freight || '--'  }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg-purple">
              <span>承运商编码：</span>
              <span>{{ form.vendorCode || '--'  }}</span>
            </div>
          </el-col>
        
        </el-row>
        <el-row :gutter="20">
          <el-col :span="9">
            <div class="grid-content bg-purple">
              <span>运输单号：</span>
              <span>{{ form.transportNumber || '--'  }}</span>
            </div>
          </el-col>
          <el-col :span="6">
            <div class="grid-content bg-purple">
              <span>快递车牌：</span>
              <span>{{ form.deliveryPlate || '--'  }}</span>
            </div>
          </el-col>
        </el-row>
        <el-tag size="large" style="font-size: 20px; margin-bottom: 10px; margin-top: 10px">产品列表</el-tag>
        <hr />
        <Productsalseline
          ref="line"
          :salseId="form.salseId"
          :warehouseId="form.warehouseId"
          :locationId="form.locationId"
          :areaId="form.areaId"
        ></Productsalseline>
        <!-- <el-table
          v-loading="loading"
          :data="routeproductbomList"
          :span-method="objectSpanMethod"
          height="73vh"
        >
          <el-table-column label="序号" align="center" width="150px" prop="issueCode">
            <template slot-scope="scope">
              <span>{{scope.$index + 1}}</span>
            </template>
          </el-table-column>
          <el-table-column label="所属工序" align="center" prop="processName" />
          <el-table-column label="物料编号" align="center" prop="itemCode" />
          <el-table-column label="物料名称" align="center" prop="itemName" />
          <el-table-column label="规格型号" align="center" prop="specification" />

          <el-table-column label="单位" width="100" align="center" prop="unitOfMeasure" />
          <el-table-column label="用量:分子" width="80" align="center" prop="jdyNumerator" />
          <el-table-column label="用量:分母" align="center" prop="jdyDenominator" />
          <el-table-column label="领料数量" width="80" align="center" prop="quantityIssued" />
        </el-table> -->
      </div>
    </el-drawer>
  </div>
</template>
  
  <script>
import { getProductsalse } from "@/api/mes/wm/productsalse";
import Productsalseline from "./line.vue";
export default {
  data() {
    return {
      openDetail: false,
      title: "查看出库单详情",
      warehouseInfo:[],
      // 表单参数
      form: {},
      loading: false,
      routeproductbomList: [],
      issueId: null
    };
  },
  components: { Productsalseline },
  dicts: ["mes_order_status"],
  methods: {
    //初始化函数
    init(row) {
      console.log(row, "子组件的row");
      this.form = row;
      this.openDetail = true;
      this.getList(row);
    },
    getList(row) {
      const salseId = row.salseId;
      getProductsalse(salseId).then(response => {
        this.form = response.data;
        this.warehouseInfo[0] = response.data.warehouseId || '';
        this.warehouseInfo[1] = response.data.locationId || '';
        this.warehouseInfo[2] = response.data.areaId || '';
        this.title = "查看出库单详情";
      });
    },
    // 取消按钮
    cancel() {
      this.openDetail = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        salseId: null,
        salseCode: null,
        salseName: null,
        oqcId: null,
        oqcCode: null,
        soCode: null,
        clientId: null,
        clientCode: null,
        clientName: null,
        clientNick: null,
        warehouseId: null,
        warehouseCode: null,
        warehouseName: null,
        locationId: null,
        locationCode: null,
        locationName: null,
        areaId: null,
        areaCode: null,
        areaName: null,
        salseDate: new Date(),
        status: "PREPARE",
        remark: null,
        attr1: null,
        attr2: null,
        attr3: null,
        attr4: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null
      };
      this.autoGenFlag = false;
      this.resetForm("form");
    },

  
  }
};
</script>
  <style rel="stylesheet/scss" lang="scss" scoped>
.app-container ::v-deep .el-drawer__header {
  padding-top: 10px !important;
  padding-bottom: 5px !important;
  margin-bottom: 10px !important;
}

.bg-purple {
  display: flex;
  align-items: center;
  span:nth-child(1) {
    display: inline-block;
    // width: 100px;
    margin-right: 10px;
    white-space: nowrap;
    line-height: 30px;
  }
}
.titleDiv {
  font-weight: 700 !important;
  font-size: 20px;
}
</style>
  